package com.gsy.HW402;


import com.gsy.gsy_common_util.fileUtil.FileUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.TreeMap;

public class HW1 {
    public static void main(String[] args) {
        File file = new File("d:/test/spice.din");
//        File file = new File("d:/test/tex.din");
        try {
            String s = FileUtils.fileToString(file);
            HashMap<String,Integer> hashMap0 = new HashMap<>();
            TreeMap<Integer,Integer> hashMap1 = new TreeMap<>();
            String arr[] = s.split("\n");
            System.out.println(arr.length);
            for (String s1 : arr) {
                String aaa[] = s1.split("\\s");
                hashMap0.put(aaa[0],hashMap0.getOrDefault(aaa[0],0)+1);
//                if (aaa[0].equals("2")){
//                System.out.println(Arrays.toString(aaa));
                    int a = Integer.valueOf(aaa[1],16);
//                System.out.println(a);
                    hashMap1.put(a,hashMap1.getOrDefault(a,0)+1);
//                }
            }
            System.out.println(hashMap0.toString());
            System.out.println(hashMap1.size());
            System.out.println(hashMap1.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
